<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/16
 * Time: 14:29
 */
header('Content-Type:application/json');
include '../classes/logincheck.php';
include '../classes/conn.php';
if(!islogin()=='stu_login') {
    die('error');
}

$id=$_POST['id'];
$student=$_SESSION['stu_num'];

$queryClass="select class from homework where Id='{$id}'";
$res=mysql_query($queryClass);
$row=mysql_fetch_assoc($res);
$class=$row['class'];

$subs=array();
$query="select * from submit where homework='{$id}' and student='{$student}' and class='{$class}'";
$res=mysql_query($query);
while ($row=mysql_fetch_assoc($res)){
    $subs[]=$row;
}
$data=json_encode($subs);
echo $data;
mysql_close($conn);
